import { showRealAmount } from '@/api/order'

export default {
  data () {
    return {
      isShowReal: null,
      sum: {
        totalGunAmount: {
          value: '0.00',
          title: '加油金额汇总',
          unit: '元'
        },
        totalRealPayAmount: {
          value: '0.00',
          title: '实付金额汇总',
          unit: '元'
        },
        // preferentialAmount: {
        //   value: '0.00',
        //   title: '优惠金额汇总',
        //   unit: '元',
        //   showI: {
        //     amountActivityMerchant: {
        //       value: '0.00',
        //       title: '商家承担直降金额',
        //       unit: '元'
        //     },
        //     amountPlatformCouponMerchant: {
        //       value: '0.00',
        //       title: '商家承担平台优惠券金额',
        //       unit: '元'
        //     },
        //     merchantCouponAmount: {
        //       value: '0.00',
        //       title: '商家优惠券金额',
        //       unit: '元'
        //     },
        //     platformProfitAmount: {
        //       value: '0.00',
        //       title: '平台让利金额',
        //       unit: '元'
        //     },
        //   }
        // },
        orderCount: {
          value: '0',
          title: '加油笔数',
          unit: '笔'
        },
        totalLitre: {
          value: '0',
          title: '加油升数汇总',
          unit: '升'
        }
      },
      refund: {
        totalRefundAmount: {
          value: '0.00',
          title: '退款金额汇总',
          unit: '元'
        },
        refundCount: {
          value: '0',
          title: '退款笔数',
          unit: '笔'
        },
        totalRefundLitre: {
          value: '0',
          title: '退款升数汇总',
          unit: '升'
        }
      },
      settle: {
        totalSettlement: {
          value: '0.00',
          title: '应结算金额',
          unit: '元'
        },
        totalChannelFee: {
          value: '0.00',
          title: '通道费金额',
          unit: '元'
        },
        preferentialMerchantsAmount: {
          value: '0.00',
          title: '商家优惠金额',
          unit: '元',
          showI: {
            amountActivityMerchant: {
              value: '0.00',
              title: '商家承担直降金额',
              unit: '元'
            },
            amountPlatformCouponMerchant: {
              value: '0.00',
              title: '商家承担平台优惠券金额',
              unit: '元'
            },
            merchantCouponAmount: {
              value: '0.00',
              title: '商家优惠券金额',
              unit: '元'
            },
            platformProfitAmount: {
              value: '0.00',
              title: '平台让利',
              unit: '元'
            }
          }
        },
        totalRealSettlement: {
          value: '0.00',
          title: '实际结算金额',
          unit: '元'
        }
      }
    }
  },
  async mounted () {
    try {
      const {code, result} = await showRealAmount()
      if (code !== 200) return
      this.isShowReal = result
      if (!result) {
        delete this.sum.totalRealPayAmount
        if (this.gasDutyData) {
          delete this.gasDutyData[0]['实付金额汇总']
        }
      }
    } catch (error) {
      console.log(error)
    }
  }
}